﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Pixysoft.SQL
{
    public class SqlColumn
    {
        string tablename;

        string columnname;

        public SqlColumn(string tablename, string columnname)
        {
            this.tablename = tablename;
            this.columnname = columnname;
        }

        public string AS(string columnname)
        {
            return string.Format("{0} AS {1}", this.columnname, columnname);
        }

        public string AS()
        {
            return string.Format("{0} AS {0}", this.columnname);
        }

        public string TableName
        {
            get { return tablename; }
        }

        public string ColumnName
        {
            get { return columnname; }
        }

        public override string ToString()
        {
            return columnname;
        }

        public static implicit operator string(SqlColumn c)
        {
            return c.columnname;
        }
    }
}
